package cn.itrip.common;

import redis.clients.jedis.JedisPool;

/**
 * @author jie
 * @date 2019/5/7 -9:20
 */
public class RedisAPI {
    private JedisPool jedisPool;

    public JedisPool getJedisPool() {
        return jedisPool;
    }

    public void setJedisPool(JedisPool jedisPool) {
        this.jedisPool = jedisPool;
    }

    public void set(String key, String value){
        jedisPool.getResource().set(key,value);
    }
    public void set(String key,int seconds,String value){
        jedisPool.getResource().setex(key,seconds,value);
    }
    public String get(String key){
        return jedisPool.getResource().get(key);
    }
    public void del(String key){
        jedisPool.getResource().del(key);
    }
}
